package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.SectionDao;
import cn.topevery.garden.entity.po.Section;
import cn.topevery.garden.entity.query.SectionQuery;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 
 *
 * @author code-generate
 * @date 2021-08-06
 */
@Service
public class SectionLogic extends BaseLogic<Section> {
    @Autowired
    SectionDao sectionDao;

    @Override
    public BaseEntityDao<Section, Integer> getDao() {
        return sectionDao;
    }


    public Map<String, Object> getBasicInfo(Integer id){ return sectionDao.getBasicInfo(id);};

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<Section> listPage(SectionQuery query) {
        return sectionDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        sectionDao.delete(userId, ids);
    }


    public List<Map<String,Object>> getShortList(){
        return sectionDao.getShortList();
    }

    public void insertFillIdentity(String userId, Section val) {
        sectionDao.insertFillIdentity(userId,val);
    }

    /**
     * 描述 通过名称获取Id.
     *
     * @param name the name
     * @return the integer
     * @author wenzhao.lin
     * @created 2021 -08-19 13:23:05 Get section by name integer.
     */
    public Integer getSectionIdByName(String name){
        return sectionDao.getSectionIdByName(name);
    }
}
